]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Magnifier: demote exceptions reading focus/caret position
authorGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 13 Feb 2014 15:12:59 +0000 (16:12 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 13 Feb 2014 18:31:00 +0000 (19:31 +0100)
It's possible that the DBus call goes in timeout (which is bad,
but unavoidable, given that atspi is synchronous) or fails
because the component has been removed (race condition). Those
errors are not dependent on gnome-shell, but on faulty applications
(mostly).
If they happen, log a debug message and continue.

https://bugzilla.gnome.org/show_bug.cgi?id=724305

js/ui/magnifier.js

index 81e3553a4b3ad2c349e835188f07bde7861df5c4..b02b1146c63c5e8906a5acfce2844dc7ea8de63a 100644 (file)
@@ -719,7 +719,14 @@ const ZoomRegion = new Lang.Class({
         let component = event.source.get_component_iface();
         if (!component || event.detail1 != 1)
             return;
-        let extents = component.get_extents(Atspi.CoordType.SCREEN);
+        let extents;
+        try {
+            extents = component.get_extents(Atspi.CoordType.SCREEN);
+        } catch(e) {
+            log('Failed to read extents of focused component: ' + e.message);
+            return;
+        }
+
         [this._xFocus, this._yFocus] = [extents.x + (extents.width / 2),
                                         extents.y + (extents.height / 2)];
         this._centerFromFocusPosition();
@@ -729,7 +736,14 @@ const ZoomRegion = new Lang.Class({
         let text = event.source.get_text_iface();
         if (!text)
             return;
-        let extents = text.get_character_extents(text.get_caret_offset(), 0);
+        let extents;
+        try {
+            extents = text.get_character_extents(text.get_caret_offset(), 0);
+        } catch(e) {
+            log('Failed to read extents of text caret: ' + e.message);
+            return;
+        }
+
         [this._xCaret, this._yCaret] = [extents.x, extents.y];
         this._centerFromCaretPosition();
     },